import 'package:get/get.dart';
import 'package:meiyunapp/page/gooddetail/good_detail_controller.dart';
import 'package:meiyunapp/page/gooddetail/good_detail_page.dart';
import 'package:meiyunapp/page/login/login_collect.dart';
import 'package:meiyunapp/page/login/login_page.dart';
import 'package:meiyunapp/page/main/main_page.dart';
import 'package:meiyunapp/page/splash_page.dart';
import 'package:meiyunapp/page/vip/vip_page.dart';
import 'package:meiyunapp/page/web/web_html_page.dart';
import 'package:meiyunapp/router/middleware/login_middleware.dart';

class RoutersPages {
  static var pages = [
    GetPage(
      name: RouterPath.splash_path,
      page: () => const SplashPage(),
    ),
    GetPage(
      name: RouterPath.home_path,
      page: () => const MainPage(),
    ),
    GetPage(
      name: RouterPath.goods_detail,
      page: () => GoodDetailPage(),
      binding: BindingsBuilder(
        () => {Get.lazyPut<GoodDetailController>(() => GoodDetailController())},
      ),
    ),
    GetPage(
        name: RouterPath.page_login,
        page: () => LoginPage(),
        binding: BindingsBuilder(() => {Get.lazyPut(() => LoginCollect())})),
    GetPage(
      name: RouterPath.page_vip,
      page: () => const VipPage(),
      middlewares: [
        LoginMiddleware(mpriority: 1),
      ],
    ),
    GetPage(
      name: RouterPath.page_web_html,
      page: () => WebHtmlPage(),
    )
  ];
}

class RouterPath {
  static const String splash_path = "/splash";
  static const String home_path = "/home";
  static const String test_page_view_path = "/test_page_view";
  static const String goods_detail = "/goods_detail";
  static const String page_login = "/login";
  static const String page_vip = "/vip";
  static const String page_404 = "/404";
  static const String page_web_html = "/page_web_html";
}
